import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.Scanner;

public class 数的范围 {
    public static void main(String[] args) throws IOException {
        /*Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int q = s.nextInt();*/
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        PrintStream out = new PrintStream(System.out);
        String string = in.readLine();
        String[] a = string.split(" ");
        int n = Integer.parseInt(a[0]);
        int q = Integer.parseInt(a[1]);
        int[] arr = new int[n];

        string = in.readLine();
        a = string.split(" ");
        for(int i=0;i<arr.length;i++) {
            arr[i]=Integer.parseInt(a[i]);
        }

        while(q-- >0) {
            int aim = Integer.parseInt(in.readLine());
            int l = 0;
            int r = arr.length-1;
            int m = 0;
            //左端点
            while(l<r) {
                m = l+r>>1;
                if(arr[m]>=aim) r=m;
                else l=m+1;
            }

            if(arr[l]==aim)
                out.print(l+" ");
            else{
                out.println("-1 -1");
                continue;
            }
            //右端点
            r= arr.length-1;
            while(l<r) {
                m=l+r+1 >>1;
                if(arr[m]<=aim) l=m;
                else r=m-1;
            }
            if (arr[r]==aim) out.print(r);
            out.println();
        }

    }

}
